<?php

namespace App\Admin\Grids;

use App\Models\Phone;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;


class PhoneList extends LazyRenderable
{
    public function grid():Grid
    {
        $uid = $this->payload['uid'];
        return  Grid::make(new Phone(), function (Grid $grid) use($uid)
        {
            $grid->tools('<a class="btn btn-primary disable-outline" style="color : #fff" href="/admin/phone?pid='.$uid.'">去导出</a>');
            $grid->model()->where('pid',$uid);
            $grid->column('id')->sortable();
            $grid->column('name');
            $grid->column('phone');
            $grid->column('pid','来自');
            $grid->column('created_at');
            $grid->disableActions();
        });
    }

}